import os

import cv2
import numpy as np

from option import parse_args


def videos_mean(video_name, args):
    diffs = os.path.join(args.root_dir, 'diffs')
    # video_name_set = get_video_name_set(args)
    video_diffs_fold = os.path.join(diffs, video_name)
    # mean_min, mean_max = 255., 0.
    # video_path = os.path.join(diffs, video_name_pair[2])
    # count_less_equal_than = 0
    # count_more_equal_than = 0
    for diff in os.listdir(video_diffs_fold):
        mask = cv2.imread(os.path.join(video_diffs_fold, diff), cv2.IMREAD_GRAYSCALE)
        print(diff, np.mean(mask))


def main():
    args = parse_args()
    print(args)
    args.save = False
    video_name = 'slyseidalf'
    videos_mean(video_name, args)


if __name__ == '__main__':
    main()
